<template>
    <div class="container">

        <Row class="btn-action">
            <Col span="24" v-if="type === '2'">
              <Button type="primary" class="mp10" :loading="loading" @click="exportData(1)"><Icon type="ios-download-outline"></Icon>导出数据</Button>
            </Col>
        </Row>

        <div class="opt-area-02">
            <div class="left-con">
                录入总数: <span>{{countData.fcnum}} 条</span>
            </div>
            <div class="right-con22">
<!--                <div class="input-frame">-->
<!--                    <Select v-model="params.hot" placeholder="发热状态" @on-change="selectlist">-->
<!--                        <Option value="">全部</Option>-->
<!--                        <Option value="0">未发热</Option>-->
<!--                        <Option value="1">发热</Option>-->
<!--                    </Select>-->
<!--                </div>-->
                <div class="input-frame" style="width: 164px">
                    <Input type="text" @on-click="selectlist(1)" placeholder="请输入姓名" style="width: 164px" v-model="params.name"
                           icon="ios-search"/>
                </div>
                <div class="input-frame" style="width: 164px">
                    <Input type="text" @on-click="selectlist(1)" placeholder="请输入身份证号" style="width: 164px" v-model="params.card_no"
                           icon="ios-search"/>
                </div>
                <div class="input-frame" style="width: 164px">
                    <Input type="text" @on-click="selectlist(1)" placeholder="请输入联系方式" style="width: 164px" v-model="params.tel"
                          icon="ios-search"/>
                </div>
              <div class="input-frame" v-if="companyCode === 'LM'" style="width: 164px">
                <Select v-model="params.area1" placeholder="区/县" style="width: 164px" filterable @on-change="perChange(1)">
                  <Option v-for="obj in addressInfo.list1" :value="obj.title" :key="obj.id">{{obj.title}}</Option>
                </Select>
              </div>
              <div class="input-frame" v-if="companyCode === 'LM'" style="width: 164px">
                <Select v-model="params.area2" placeholder="街道" style="width: 164px" filterable @on-change="perChange(2)">
                  <Option v-for="obj in addressInfo.list2" :value="obj.title" :key="obj.id">{{obj.title}}</Option>
                </Select>
              </div>
              <div class="input-frame" v-if="companyCode === 'LM'" style="width: 164px">
                <Select v-model="params.area3" placeholder="社区" style="width: 164px" filterable>
                  <Option v-for="obj in addressInfo.list3" :value="obj.title" :key="obj.id">{{obj.title}}</Option>
                </Select>
              </div>
                <Button type="info" size="small" @click="selectlist(1)" style="margin-top: 5px">搜索</Button>
            </div>
            <div class="right-con22">
                <!-- <div class="input-frame" style="width: 164px">
                  <Select v-model="params.arrive_address_type" placeholder="来沈前经过地" filterable>
                    <Option v-for="obj in dictList" :value="obj.value" :key="obj.id">{{obj.label}}</Option>
                  </Select>
                </div> -->
                <div class="input-frame" style="width: 164px">
                <Select v-model="params.user_control_type1" @on-change="changeuserControlType1()" placeholder="人员类型（一级）">
                  <Option v-for="obj in userControlType1" :value="obj.value" :key="obj.id">{{obj.label}}</Option>
                </Select>
              </div>
              <div class="input-frame" style="width: 164px" v-if="userControlType2.length > 0">
                <Select v-model="params.user_control_type2"  placeholder="人员类型（二级）">
                  <Option v-for="obj in userControlType2" :value="obj.value" :key="obj.id">{{obj.label}}</Option>
                </Select>
              </div>
              <div class="input-frame" style="width: 164px" v-if="params.user_control_type1 === '2'">
                  <Select v-model="params.follow_person" placeholder="密接相关人" style="width: 164px">
                    <Option v-for="obj in follow_personList" :value="obj.value" :key="obj.id">{{obj.label}}</Option>
                  </Select>
                </div>
                <!-- <div class="input-frame" style="width: 164px">
                  <Select v-model="params.isfollow" placeholder="密切接触人群" @on-change="selectlist" style="width: 164px">
                    <Option value="">全部</Option>
                    <Option value="0">否</Option>
                    <Option value="1">是</Option>
                    <Option value="2">按行动轨迹主动申请隔离人员</Option>
                  </Select>
                </div>
                <div class="input-frame" style="width: 164px" v-if="params.isfollow=='1'">
                  <Select v-model="params.follow_person" placeholder="密接相关人" style="width: 164px">
                    <Option v-for="obj in follow_personList" :value="obj.value" :key="obj.id">{{obj.label}}</Option>
                  </Select>
                </div>
                <div class="input-frame" style="width: 164px" v-if="params.isfollow=='1'">
                  <Select v-model="params.follow_level" placeholder="密接等级" @on-change="selectlist" style="width: 164px">
                    <Option value="">全部</Option>
                    <Option value="1">一级</Option>
                    <Option value="2">二级</Option>
                    <Option value="3">三级</Option>
                  </Select>
                </div> -->
                <!-- <div class="input-frame" style="width: 164px">
                  <Select v-model="params.illness_state" placeholder="人员状态" @on-change="selectlist" style="width: 164px">
                    <Option value="">全部</Option>
                    <Option value="1">疑似病例</Option>
                    <Option value="2">确诊病例</Option>
                    <Option value="3">死亡</Option>
                    <Option value="4">治愈</Option>
                    <Option value="5">正常</Option>
                  </Select>
                </div> -->
                <!-- <div class="input-frame" style="width: 164px">
                  <Select v-model="params.inout_state" placeholder="离沈/入沈" @on-change="selectlist" style="width: 164px">
                    <Option value="">全部</Option>
                    <Option value="1">入沈人员</Option>
                    <Option value="2">离沈人员</Option>
                  </Select>
                </div> -->
                <div class="input-frame" style="width: 164px">
                  <Select v-model="params.supervise_start" placeholder="管控状态" filterable>
                    <Option v-for="obj in superviseOneDictList" :value="obj.value" :key="obj.id">{{obj.label}}</Option>
                  </Select>
                </div>
                <div class="input-frame" style="width: 164px">
                  <Select v-model="params.supervise_timeout" placeholder="预警状态">
                    <Option value="">全部</Option>
                    <Option value="0">正常</Option>
                    <Option value="1">预警</Option>
                  </Select>
                </div>
                <div class="input-frame" style="width: 164px" v-if="params.supervise_start == '1'">
                  <Select v-model="params.is_transfer" placeholder="居家隔离类型"  filterable>
                    <Option v-for="obj in is_transferList" :value="obj.value" :key="obj.id">{{obj.label}}</Option>
                  </Select>
                </div>
                <!-- <div class="input-frame" style="width: 164px">
                  <Select v-model="params.province2" placeholder="来沈前出发地省" filterable @on-change="chaneProv(2)" style="width: 164px">
                    <Option v-for="obj in inoutCity.provinceList" :value="obj.name" :key="obj.code">{{obj.name}}</Option>
                  </Select>
                </div> -->
                <!-- <div class="input-frame" style="width: 164px">
                  <Select v-model="params.city2" placeholder="来沈前出发地市" filterable style="width: 164px">
                    <Option v-for="obj in inoutCity.city2" :value="obj.name" :key="obj.code">{{obj.name}}</Option>
                  </Select>
                </div> -->
            </div>
            <div class="right-con22">
              <!-- <div class="input-frame" style="width: 164px">
                <Select v-model="params.state" placeholder="隔离状态" @on-change="selectlist" style="width: 164px">
                  <Option value="">全部</Option>
                  <Option value="1">在家留观</Option>
                  <Option value="2">集中留观</Option>
                </Select>
              </div> -->
              <div class="input-frame" style="width: 164px">
                <Select v-model="params.nucleic_acid" placeholder="核酸检测" @on-change="selectlist(1)" style="width: 164px">
                  <Option value="">全部</Option>
                  <Option value="0">未检测</Option>
                  <Option value="1">已检测</Option>
                </Select>
              </div>
              <div class="input-frame" style="width: 164px">
                <Select v-model="params.detection_1_result" placeholder="第一次结果" @on-change="selectlist" style="width: 164px">
                  <Option value="">全部</Option>
                  <Option value="1">阴性</Option>
                  <Option value="2">阳性</Option>
                  <Option value="3">待出结果</Option>
                  <Option value="4">未检测</Option>
                </Select>
              </div>
              <div class="input-frame" style="width: 164px">
                <Select v-model="params.detection_2_result" placeholder="第二次结果" @on-change="selectlist" style="width: 164px">
                  <Option value="">全部</Option>
                  <Option value="1">阴性</Option>
                  <Option value="2">阳性</Option>
                  <Option value="3">待出结果</Option>
                  <Option value="4">未检测</Option>
                </Select>
              </div>
              <div class="input-frame" style="width: 164px">
                <Select v-model="params.affirm_state" placeholder="是否确认" style="width: 164px">
                  <Option value="">全部</Option>
                  <Option value="0">未确认</Option>
                  <Option value="1">已确认</Option>
                </Select>
              </div>
              <!-- <div class="input-frame" style="width: 164px" v-if="params.user_control_type1 === '1' || params.user_control_type1 === '5'
          || params.user_control_type1 === '3' || params.user_control_type1 === '6'"
              <Select v-model="params.cold_chain_user" placeholder="是否从事进口冷链食品相关工作返乡人员" filterable>
                <Option value="1">是</Option>
                <Option value="0">否</Option>
              </Select>
              </div> -->
              <!-- <div class="input-frame" style="width: 164px" v-if="params.user_control_type1 === '2'">
                <Select v-model="params.user_control_type2"  placeholder="密接相关人">
                  <Option v-for="obj in followPersonList" :value="obj.value" :key="obj.label">{{obj.label}}</Option>
                </Select>
              </div> -->
              <!-- <div class="input-frame" style="width: 164px">
                <Select v-model="params.risk_groups" placeholder="风险人群" @on-change="selectlist" style="width: 164px">
                  <Option value="">全部</Option>
                    <Option value="0">否</Option>
                    <Option value="1">是</Option>
                </Select>
              </div> -->
              <!-- <div class="input-frame" style="width: 164px">
                <Select v-model="params.isolation" placeholder="隔离状态" @on-change="selectlist" style="width: 164px">
                  <Option value="">全部</Option>
                  <Option value="0">未隔离</Option>
                  <Option value="1">隔离</Option>
                </Select>
              </div> -->
            </div>
        </div>
        <Table :loading="countData.loading" border :columns="columns2" :data="fcDataList" size="small" ref="table">
            <template slot-scope="{ row }" slot="nucleic_acid">
              <span v-if="row.nucleic_acid == '0'">未检测</span>
              <span v-if="row.nucleic_acid == '1'">已检测</span>
            </template>
            <template slot-scope="{ row }" slot="isolation">
              <span v-if="row.isolation == '0'">未隔离</span>
              <span v-if="row.isolation == '1'">隔离</span>
            </template>
            <template slot-scope="{ row }" slot="detection_1_result">
            <span v-if="row.detection_1_result == '1'">阴性</span>
            <span v-if="row.detection_1_result == '2'" style="color: red">阳性</span>
            <span v-if="row.detection_1_result == '3'">待出结果</span>
            <span v-if="row.detection_1_result == '4'">未检测</span>
          </template>
          <template slot-scope="{ row }" slot="supervise_timeout">
            <span v-if="row.supervise_timeout == '0'">正常</span>
            <span v-if="row.supervise_timeout == '1'" style="color: red">预警</span>
          </template>
          <template slot-scope="{ row }" slot="detection_2_result">
            <span v-if="row.detection_2_result == '1'">阴性</span>
            <span v-if="row.detection_2_result == '2'" style="color: red">阳性</span>
            <span v-if="row.detection_2_result == '3'">待出结果</span>
            <span v-if="row.detection_2_result == '4'">未检测</span>
          </template>
          <template slot-scope="{ row }" slot="follow_level">
            <span v-if="row.follow_level == '1'">一级密接</span>
            <span v-if="row.follow_level == '2'">二级密接</span>
            <span v-if="row.follow_level == '3'">三级密接</span>
          </template>
          <template slot-scope="{ row }" slot="user_control_type1">
            <span v-for="obj in userControlType1" v-bind:key="obj.value" v-if="obj.value === row.user_control_type1">{{obj.label}}</span>
          </template>
          <template slot-scope="{ row }" slot="user_control_type2">
            <span v-for="obj in userControlType1" v-bind:key="obj.value" v-if="obj.value === row.user_control_type1">
              <!-- {{obj.downlist}} -->
              <span v-for="obj1 in obj.downlist" v-bind:key="obj1.value" v-if="obj1.value === row.user_control_type2">{{obj1.label}}</span>
            </span>
          </template>
            <template slot-scope="{ row }" slot="illness_state">
              <span v-if="row.illness_state == '1'" style="color: red">疑似病例</span>
              <span v-if="row.illness_state == '2'" style="color: red">确诊病例</span>
              <span v-if="row.illness_state == '3'" style="color: red">死亡</span>
              <span v-if="row.illness_state == '4'" >治愈</span>
              <span v-if="row.illness_state == '5'" >正常</span>
            </template>
            <template slot-scope="{ row }" slot="inout_state">
              <span v-if="row.inout_state == '1'">入沈人员</span>
              <span v-if="row.inout_state == '2'">离沈人员</span>
            </template>
            <template slot-scope="{ row }" slot="paper_card">
              <span v-if="row.paper_card == '0'">没有</span>
              <span v-if="row.paper_card == '1'">有</span>
            </template>
            <template slot-scope="{ row }" slot="app_card">
              <span v-if="row.app_card == '0'">没有</span>
              <span v-if="row.app_card == '1'">有</span>
            </template>
          <template slot-scope="{ row }" slot="is_monitoring">
            <span v-if="row.is_monitoring == '0'">是</span>
            <span v-if="row.is_monitoring == '1'">否</span>
            <span v-if="(row.supervise_start == '8' && row.is_monitoring == null) || (row.is_monitoring == undefined && row.supervise_start == '8')" style="color:red">请完善安防手段</span>
          </template>
<!--            <template slot-scope="{ row }" slot="hot">-->
<!--              <span v-if="row.hot == '1'" style="color: red">发热</span>-->
<!--              <span v-else>未发热</span>-->
<!--            </template>-->
            <template slot-scope="{ row }" slot="referral">
              <span v-if="row.referral == '1'">已送诊</span>
              <span v-else style="color: red">未送诊</span>
            </template>
            <template slot-scope="{ row }" slot="supervise_start1">
              <span v-if="row.supervise_start1 === '送诊'" style="color: red">送诊</span>
              <span v-else>{{row.supervise_start1}}</span>
            </template>
            <template slot-scope="{ row }" slot="isaffirm_state">
            <span v-if="row.affirm_state == '0'" style="color: red">未确认</span>
            <span v-if="row.affirm_state == '1'">已确认</span>
          </template>
            <template slot-scope="{ row }" slot="state">
              <span v-if="row.state == '1'">在家留观</span>
              <span v-if="row.state == '2'">集中留观</span>
            </template>
            <template slot-scope="{ row }" slot="isfollow">
              <span v-if="row.isfollow == '1'" style="color: red">是</span>
              <span v-else>否</span>
            </template>
<!--            <template slot-scope="{ row }" slot="arrive_address_type">-->
<!--              <span v-if="row.arrive_address_type == '1'" style="color: red">湖北武汉</span>-->
<!--              <span v-if="row.arrive_address_type == '2'" style="color: red">湖北其他城市</span>-->
<!--              <span v-if="row.arrive_address_type == '5'" style="color: red">浙江温州</span>-->
<!--              <span v-if="row.arrive_address_type == '6'" style="color: red">韩国</span>-->
<!--              <span v-if="row.arrive_address_type == '7'" style="color: red">日本</span>-->
<!--              <span v-if="row.arrive_address_type == '3'">其他省市</span>-->
<!--            </template>-->
            <template slot="action" slot-scope="{ row }">
                <Row style="margin-bottom: 5px; margin-top: 2px">
                    <Button class="table-action-btn" type="info" size="small" @click="showdetail(row, 'info', params.states)">详情</Button>
                    <Button class="table-action-btn" type="success" size="small" @click="showdetail(row, 'edit', params.states)" v-if="row.affirm_state !== '0'">编辑</Button>
                    <Button class="table-action-btn" v-if="(params.user_type == '1' || params.user_type == '2') && row.affirm_state !== '0'" type="info" size="small" @click="exchange(row)">转换</Button>
                    <Button class="table-action-btn" type="primary" size="small" @click="temperature(row)" v-if="row.affirm_state !== '0'">管控档案</Button>
                    <!-- <Button class="table-action-btn" type="info" size="small" @click="passCheck(row, 'paper')">纸质证</Button> -->
                </Row>
                <Row style="margin-bottom: 5px; margin-top: 2px" v-if="row.affirm_state !== '0'">
<!--                    <Button class="table-action-btn" type="success" size="small" @click="fever(row)">发热</Button>-->
                  <!-- <Button class="table-action-btn" type="primary" size="small" @click="leave(row)">离沈</Button> -->
                  <!-- <Button class="table-action-btn" type="warning" size="small" @click="Referral(row)" >送诊</Button> -->
<!--                  <Button class="table-action-btn" type="error" size="small" @click="deleteRow(row)">删除</Button>-->
                  <Button class="table-action-btn" type="info" size="small" @click="moveOut(row)">迁出</Button>
                  <Button class="table-action-btn" type="info" size="small" @click="jzgl(row)">集中隔离</Button>
                  <!-- <Button class="table-action-btn" type="info" size="small" @click="zwjkgl(row)">自我健康管理</Button> -->
                  <Button class="table-action-btn" type="info" size="small" @click="saveJksf(row)">健康随访</Button>
                  <!-- <Button class="table-action-btn" type="success" size="small" @click="passCheck(row, 'app')">电子证</Button> -->
                  <!-- <Button class="table-action-btn" type="primary" size="small" @click="quarantine(row)">隔离</Button> -->
                </Row>
                <Row style="margin-bottom: 5px; margin-top: 2px" v-if="row.affirm_state !== '0'">
<!--                    <Button class="table-action-btn" type="success" size="small" @click="fever(row)">发热</Button>-->
                  <!-- <Button class="table-action-btn" type="primary" size="small" @click="leave(row)">离沈</Button> -->
                  <Button class="table-action-btn" type="success" size="small" @click="disisolation(row,'jc')">解除管控</Button>
                  <Button class="table-action-btn" type="info" size="small" @click="disisolation(row,'jkjc')">社区健康监测</Button>
                  <Button class="table-action-btn" type="error" size="small" @click="ZWQZ(row)">转为送诊</Button>
                </Row>
                <Row style="margin-bottom: 5px; margin-top: 2px">
                  <Button v-if="row.affirm_state === '0' && row.supervise_start === '8'" class="table-action-btn" type="error" size="small" @click="queren(row)">接收该解除集中隔离人员</Button>
                </Row>
                <Row style="margin-bottom: 5px; margin-top: 2px">
                  <Button v-if="row.affirm_state === '0' && row.supervise_start === '8'" class="table-action-btn" type="warning" size="small" @click="huitui(row)">退回该解除集中隔离人员</Button>
                </Row>
            </template>
        </Table>
        <Row v-if="loadData == true">
          <Col class="demo-spin-col" span="8" offset="8">
            <Spin fix>
              <Icon type="ios-loading" size=18 class="demo-spin-icon-load"></Icon>
              <div>Loading</div>
            </Spin>
          </Col>
        </Row>
        <Row type="flex" justify="end" class="page_style">
          <Page :current="params.pageNo" :total="params.totalRecord" show-sizer :page-size="params.pageSize"
                show-total @on-change="pageAction" @on-page-size-change="pageSizeChange"/>
        </Row>
        <Modal v-model="modal1" title="发热情况" @on-ok="ok" @on-cancel="cancel">
            <RadioGroup v-model="hot">
              <Radio label="0">未发热</Radio>
              <Radio label="1">发热</Radio>
            </RadioGroup>
        </Modal>
        <Modal v-model="modal2" title="送诊情况" @on-ok="ok1" @on-cancel="cancel">
            <Row class="mb20">
              <Col span="5" offset="1" class="ivu-form-item-label">是否送诊：</Col>
              <Col span="8" class="ivu-form-item-content">
                <RadioGroup v-model="referralInfo.referral">
                  <Radio label="0">未送诊</Radio>
                  <Radio label="1">送诊</Radio>
                </RadioGroup>
              </Col>
            </Row>
            <Row class="mb20" v-if="referralInfo.referral == '1'">
              <Col span="5" offset="1" class="ivu-form-item-label">送诊医院：</Col>
              <Col span="8" class="ivu-form-item-content">
                <Select v-model="referralInfo.referral_address" placeholder="送诊医院" filterable style="width: 300px">
                  <Option v-for="obj in hospital_list" :value="obj.hospital_name" :key="obj.hospital_name">{{obj.hospital_name}}</Option>
                </Select>
              </Col>
            </Row>
        </Modal>
        <Modal v-model="modal4" title="离沈情况" @on-ok="ok2" @on-cancel="cancel">
          <Row class="mb20">
            <Col span="5" offset="1" class="ivu-form-item-label">是否离沈：</Col>
            <Col span="8" class="ivu-form-item-content">
              <RadioGroup v-model="modalInfo1.inout_state">
                <Radio label="1">来沈人员</Radio>
                <Radio label="2">离沈人员</Radio>
              </RadioGroup>
            </Col>
          </Row>
          <Row class="mb20" v-if="modalInfo1.inout_state == '2'">
            <Col span="5" offset="1" class="ivu-form-item-label">目的地：</Col>
            <Col span="7">
                <Select v-model="modalInfo1.province1" placeholder="省" filterable @on-change="change(1)" style="width: 140px">
                  <Option v-for="obj in cityInfo.list1" :value="obj.name" :key="obj.code">{{obj.name}}</Option>
                </Select>
            </Col>
            <Col span="6" offset="1">
                <Select v-model="modalInfo1.province2" placeholder="市" filterable style="width: 140px">
                  <Option v-for="obj in cityInfo.list2" :value="obj.name" :key="obj.id">{{obj.name}}</Option>
                </Select>
            </Col>
          </Row>
          <Row class="mb20" v-if="modalInfo1.inout_state == '2'">
            <Col span="5" offset="1" class="ivu-form-item-label">离沈时间：</Col>
            <Col span="8" class="ivu-form-item-content">
              <DatePicker type="datetime" placeholder="选择时间" v-model="modalInfo1.out_time" style="width: 300px" ></DatePicker>
            </Col>
          </Row>
          <Row class="mb20" v-if="modalInfo1.inout_state == '2'">
            <Col span="5" offset="1" class="ivu-form-item-label">离沈方式：</Col>
            <Col span="8" class="ivu-form-item-content">
              <Select v-model="modalInfo1.out_type" placeholder="请选择交通方式" style="width: 300px">
                <Option value="1">火车</Option>
                <Option value="2">轮船</Option>
                <Option value="3">飞机</Option>
                <Option value="4">大巴</Option>
                <Option value="5">自驾</Option>
              </Select>
            </Col>
          </Row>
          <Row class="mb20" v-if="modalInfo1.inout_state == '2'">
            <Col span="5" offset="1" class="ivu-form-item-label">交通方式备注：</Col>
            <Col span="8">
              <Input v-model="modalInfo1.out_type_remark" placeholder="交通方式备注" type="textarea" style="width: 300px"></Input>
            </Col>
          </Row>
          <Row v-if="modalInfo1.inout_state == '2'">
            <Col span="5" offset="1" class="ivu-form-item-label">备注：</Col>
            <Col span="8">
              <Input v-model="modalInfo1.isout_sheny_remark" placeholder="离沈后轨迹" type="textarea" style="width: 300px"></Input>
            </Col>
          </Row>
        </Modal>
        <Modal v-model="modal3" title="选择迁出到社区" @on-ok="saveCompany()" @on-cancel="cancel">
            <Form label-position="right" :label-width="100">
              <Row>
                <Col span="5" class="ivu-form-item-label">迁入社区：</Col>
                <Col span="16" class="ivu-form-item-content">
                  <Select v-model="modalStr" filterable>
                    <Option v-for="company in company_list" :value="JSON.stringify(company)"
                            v-bind:key="company.key">{{company.sq_name }} {{company.name}}（{{company.code}}）</Option>
                  </Select>
                </Col>
              </Row>
            </Form>
        </Modal>
        <Modal v-model="modal5" title="设置隔离状态" @on-ok="saveQuarantine()" @on-cancel="cancel">
            <Form label-position="right" :label-width="100">
              <Row>
                <Col span="5" class="ivu-form-item-label">是否隔离</Col>
                <Col span="16" class="ivu-form-item-content" style="margin-top:6px">
                  <RadioGroup v-model="quarantineParam.isolation">
                      <Radio label="1">
                          <span>是</span>
                      </Radio>
                      <Radio label="0">
                          <span>否</span>
                      </Radio>
                  </RadioGroup>
                </Col>
              </Row>
            </Form>
        </Modal>
        <Modal v-model="modalCard" :title="titleCard" @on-ok="okCard" @on-cancel="cancel">
          <p style="margin-left: 90px; font-size: 1rem">{{checkCardTitle}}</p>
        </Modal>
      <Modal
        v-model="jzmodal1"
        title="集中隔离"
        @on-ok="jzok"
        @on-cancel="cancel">
        集中隔离后将数据提交给区防指，请确定操作！
      </Modal>
      <Modal
          v-model="ZWQZModal"
          title="转为送诊"
          @on-ok="ZWQZOk"
          @on-cancel="cancel">
          <p>是否转为送诊?</p>
        </Modal>
      <Modal v-model="zwlInfo.show" title="设置隔离状态" @on-ok="saveZwjkgl()" @on-cancel="cancel">
            <Form label-position="right" :label-width="100">
              <Row class="bench_search">
                <Col span="10" offset="1" class="ivu-form-item-label">本次自我健康管理开始日期：</Col>
                <Col span="10" class="ivu-form-item-content">
                  <DatePicker type="date" placeholder="选择日期" style="width: 100%" v-model="zwlInfo.supervisezw_time"></DatePicker>
                </Col>
              </Row>
              <Row class="bench_search">
                <Col span="10" offset="1" class="ivu-form-item-label">本次自我健康管理结束日期：</Col>
                <Col span="10" class="ivu-form-item-content">
                  <DatePicker type="date" placeholder="选择日期" style="width: 100%" v-model="zwlInfo.supervisezw_end_time"></DatePicker>
                </Col>
              </Row>
            </Form>
        </Modal>
      <!-- 解除隔离承诺 -->
      <Modal v-model="jcglInfo.show" title="温馨提示" :styles="{top: '20px'}" width="500">
        <!-- <img :src="temp_photo" alt=""> -->
        <Row class="bench_search" style="margin-bottom:20px">
          <Col span="3" offset="1" class="ivu-form-item-label" style="font-size: 3rem;color: orange;"><Icon type="md-notifications-outline" /></Col>
          <Col span="18" class="ivu-form-item-label" style="font-size:1rem">您已隔离期满，后续如果您身体有发热等异常情况，请于第一时间联系医务工作者，您的医务工作者是：{{protect_user1}}，联系电话：
        {{protect_tel1}}</Col>
        </Row>
        <Row class="bench_search">
          <Col span="5" offset="3" class="ivu-form-item-label">管控结束日期：</Col>
          <Col span="12" class="ivu-form-item-content">
            <DatePicker type="date" placeholder="选择日期" style="width: 100%" v-model="jcglInfo.supervise_end_time"></DatePicker>
          </Col>
        </Row>
        <div slot="footer">
            <Button type="info" @click="confirmJc">我承诺</Button>
            <Button @click="cancelJc">关闭</Button>
        </div>
      </Modal>
    </div>
</template>

<script>
import { userlist, updateuserinfo, delbyid, createOutApplu, findOutAllList, getAllUserByMZNotNCList,
  date0str, findAllHospitalList, getDictList, updateAffirmTime, relieveIsolation, updateRelieveIsolationsq } from '@/api/yi-qing-fang-kong'
import { grid_downlist, date2str } from '@/api/eventlist'
import { getCityList } from '@/api/common'
import saveparams from '@/view/yi-qing-fang-kong/saveparams.vue'
// import { repetitionApply } from '../../../api/common'
// import { forEach } from '@/libs/tools'
export default {
  name: 'list',
  data () {
    return {
      protect_user1: '',
      protect_tel1: '',
      temp_supervise_end_time: '',
      flag_supervise_state: false, // 监控管控状态是否发生变化
      jcglInfo: {
        show: false,
        supervise_end_time: ''
      },
      jzmodal1: false,
      zwjkglmodal1: false,
      zwlInfo: {
        show: false,
        supervisezw_end_time: '',
        supervisezw_time: ''
      },
      quarantineParam: {
        id: ''
      },
      follow_personList: [],
      is_transferList: [],
      dictList: [],
      ZWQZModal: false,
      superviseDictList: [],
      superviseOneDictList: [],
      loadData: true,
      hospital_list: [],
      userControlType2: [],
      userControlType1: [],
      cityStr: '',
      cityInfo: { list1: [], list2: [] },
      cityList: [],
      disisolationModal: false,
      modalInfo1: {
        inout_state: '',
        isout_sheny_remark: '',
        id: this.id
      },
      modal4: false,
      modalCard: false,
      titleCard: '',
      checkCardTitle: '',
      loading: false,
      fcAllDataList: [],
      modalStr: '',
      modalInfo: {
        in_company: '',
        user_id: '',
        out_company_name: '',
        in_company_name: ''
      },
      type: this.$route.query.type, // 列表类型
      addressInfo: { list1: [], list2: [], list3: [] },
      inoutCity: { provinceList: [], city1: [], city2: [] },
      company_list: [],
      id: '',
      hot: '',
      referralInfo: {
        referral: '',
        referral_address: '',
        id: this.id
      },
      modal1: false,
      modal2: false,
      modal3: false,
      modal5: false,
      row: {},
      countData: { loading: false, fcnum: 0, ytbnum: 0, zcnum: 0 },
      params: { name: '', type: '', pageNo: 1, pageSize: 10, totalRecord: 0, state: '', area1: '', area2: '', area3: '', arrive_address_type: '', hot: '', isfollow: '', user_type: '', inout_state: '', originate_province: '', originate_city: '', states: '', nucleic_acid: '', isolation: '', supervise_start: '', supervise_timeout: '' },
      columns2: [
        { title: '姓名', key: 'NAME', width: 100, align: 'center', fixed: 'left' },
        { title: '联系方式', key: 'tel', width: 120, align: 'center' },
        { title: '身份证号', key: 'card_no1', width: 160, align: 'center' },
        { title: '性别', key: 'sex', width: 80, align: 'center' },
        // { title: '核酸检测', slot: 'nucleic_acid', width: 100, align: 'center' },
        // { title: '第一次检测结果', slot: 'detection_1_result', width: 100, align: 'center' },
        // { title: '第二次检测结果', slot: 'detection_2_result', width: 100, align: 'center' },
        // { title: '隔离状态', slot: 'isolation', width: 100, align: 'center' },
        // { title: '人员状态', slot: 'illness_state', width: 100, align: 'center' },
        // { title: '离沈状态', slot: 'inout_state', width: 100, align: 'center' },
        { title: '人员类型（一级）', slot: 'user_control_type1', width: 120, align: 'center' },
        { title: '人员类型（二级）', slot: 'user_control_type2', width: 120, align: 'center' },
        { title: '密接相关人', key: 'follow_person', width: 100, align: 'center' },
        { title: '管控状态', slot: 'supervise_start1', width: 120, align: 'center' },
        { title: '居家隔离状态', key: 'is_transfer', width: 100, align: 'center' },
        { title: '本次管控开始日期', key: 'supervise_time', width: 100, align: 'center' },
        { title: '本次管控结束日期', key: 'supervise_end_time', width: 100, align: 'center' },
        { title: '预警状态', slot: 'supervise_timeout', width: 100, align: 'center' },
        { title: '预警时间', key: 'supervise_day', width: 100, align: 'center' },
        // { title: '发热状态', slot: 'hot', width: 100, align: 'center' },
        // { title: '送诊状态', slot: 'referral', width: 100, align: 'center' },
        // { title: '隔离状态', slot: 'state', width: 100, align: 'center' },
        { title: '纸质证', slot: 'paper_card', width: 80, align: 'center' },
        { title: '电子证', slot: 'app_card', width: 80, align: 'center' },
        { title: '安防设备管控', slot: 'is_monitoring', width: 100, align: 'center' },
        // { title: '密切接触人群(是/否)', slot: 'isfollow', width: 100, align: 'center' },
        // { title: '密接等级', slot: 'follow_level', width: 100, align: 'center' },
        { title: '是否确认', slot: 'isaffirm_state', width: 100, align: 'center' },
        { title: '社区确认时间', key: 'affirm_time', width: 100, align: 'center' },
        { title: '转社区时间', key: 'olation_out_time', width: 100, align: 'center' },
        // { title: '剩余安全观察期日期', key: 'safe_date', width: 150, align: 'center' },
        { title: '来沈前经过地', key: 'arrive_address_type1', width: 120, align: 'center' },
        { title: '来沈前出发地省', key: 'originate_province', width: 130, align: 'center' },
        { title: '来沈前出发地市', key: 'originate_city', width: 130, align: 'center' },
        { title: '住所所属区、县(市)', key: 'area', width: 80, align: 'center' },
        { title: '住所所属街道(乡镇)', key: 'street', width: 80, align: 'center' },
        { title: '住所所属社区(村)', key: 'community', width: 100, align: 'center' },
        { title: '当前所属社区', key: 'company_name', width: 100, align: 'center' },
        { title: '录入时间', key: 'create_time', width: 200, align: 'center' },
        { title: '来沈时间', key: 'arrive_time', width: 200, align: 'center' },
        { title: '具体地址', key: 'address1', minWidth: 250, align: 'center' },
        { title: '操作', align: 'center', width: 270, slot: 'action', fixed: 'right' }
      ],
      columns1: [
        { title: '姓名', key: '姓名', width: 100, align: 'center', fixed: 'left' },
        { title: '性别', key: '性别', width: 160, align: 'center' },
        { title: '送诊', key: '送诊', width: 80, align: 'center' },
        { title: '送诊地址', key: '送诊地址', width: 80, align: 'center' },
        { title: '发热', key: '发热', width: 80, align: 'center' },
        { title: '证件类型', key: '证件类型', width: 100, align: 'center' },
        { title: '证件号', key: '证件号', width: 120, align: 'center' },
        { title: '街道', key: '街道', width: 100, align: 'center' },
        { title: '联系方式', key: '联系方式', width: 120, align: 'center' },
        { title: '包保人联系方式', key: '包保人联系方式', width: 120, align: 'center' },
        // { title: '人员状态', key: '人员状态', width: 160, align: 'center' },
        // { title: '人员状态备注', key: '人员状态备注', width: 160, align: 'center' },
        { title: '区/县', key: '区/县', width: 120, align: 'center' },
        { title: '社区', key: '社区', width: 80, align: 'center' },
        { title: '具体地址', key: '具体地址', width: 200, align: 'center' },
        { title: '留观', key: '留观', width: 80, align: 'center' },
        { title: '来沈时间', key: '来沈时间', width: 80, align: 'center' },
        { title: '交通方式', key: '交通方式', width: 80, align: 'center' },
        { title: '来沈后活动路径', key: '来沈后活动路径', minWidth: 250, align: 'center' },
        { title: '来沈前经过地类型', key: '来沈前经过地类型', minWidth: 250, align: 'center' },
        { title: '来沈前经过地', key: '来沈前经过地', width: 120, align: 'center' },
        { title: '同行人员', key: '同行人员', width: 120, align: 'center' },
        { title: '接触人员', key: '接触人员', width: 120, align: 'center' },
        { title: '填写时间', key: '填写时间', minWidth: 100, align: 'center' },
        { title: '机构名称', key: '机构名称', minWidth: 100, align: 'center' },
        { title: '机构编号', key: '机构编号', width: 200, align: 'center' },
        { title: '是否删除', key: '是否删除', width: 200, align: 'center' }
      ],
      fcDataList: []
    }
  },
  computed: {
    companyCode () {
      return this.$store.state.user.severUserInfo.company_code
    }
  },
  watch: {
    $route: function (to, from) {
      console.log(this.$route.query.type, to, '!@!@#@')
      if (to.query.type) {
        this.type = to.query.type
      }
      if (to.query.user_type) {
        this.params.user_type = to.query.user_type
      }
      if (to.query.states) {
        this.params.states = to.query.states
      }
      console.log(this.params, '入参')
      this.selectlist()
    }
  },
  methods: {
    jzok () {
      let data = {
        id: this.id,
        supervise_start: '7',
        send: 'send'
      }
      updateuserinfo(data).then(res => {
        if (res.data.errcode === 0) {
          this.$Notice.success({
            title: '成功',
            desc: res.data.errmsg
          })
        }
      })
    },
    disisolation (row, type) {
      this.protect_tel1 = '未知'
      if (row.protect_tel1) {
        this.protect_tel1 = row.protect_tel1
      }
      this.protect_user1 = '未知'
      if (row.protect_user1) {
        this.protect_user1 = row.protect_user1
      }
      if (type === 'jc') {
        this.id = row.id
        this.temp_supervise_end_time = row.supervise_end_time
        // this.jcglInfo.supervise_end_time = row.supervise_end_time
        this.jcglInfo.show = true
        this.jcglInfo.supervise_end_time = ''
        // this.$Modal.confirm({
        //   title: '温馨提示',
        //   content: '您已隔离期满，后续如果您身体有发热等异常情况，请于第一时间联系医务工作者，您的医务工作者是' + protect_user1 + '，联系电话：' +
        //   protect_tel1 + '。',
        //   okText: '我承诺',
        //   cancelText: '取消',
        //   onCancel: () => { },
        //   onOk: () => {
        //     let params = {
        //       id: row.id,
        //       supervise_start: '6'
        //     }
        //     console.log(params)
        //     updateRelieveIsolationsq(params).then(res => {
        //       if (res.data.errcode === 0) {
        //         this.$Notice.success({
        //           title: '',
        //           desc: '解除管控成功'
        //         })
        //         this.selectlist()
        //         return
        //       }
        //       this.$Notice.error({
        //         title: '失败',
        //         desc: res.data.errmsg
        //       })
        //     })
        //   }
        // })
      } else if (type === 'jkjc') {
        if (!row.user_control_type2) {
          this.$Notice.error({
            title: '失败',
            desc: '人员基本信息人员类型二级为空，转换失败！'
          })
        } else {
          this.$Modal.confirm({
            title: '温馨提示',
            content: '是否确认将人员管控状态转为社区健康监测',
            okText: '确认',
            cancelText: '取消',
            onCancel: () => { },
            onOk: () => {
              let params = {
                id: row.id,
                supervise_start: '8'
              }
              console.log(params)
              updateRelieveIsolationsq(params).then(res => {
                if (res.data.errcode === 0) {
                  this.$Notice.success({
                    title: '',
                    desc: '转为社区健康监测成功'
                  })
                  this.selectlist()
                  return
                }
                this.$Notice.error({
                  title: '失败',
                  desc: res.data.errmsg
                })
              })
            }
          })
        }
      }
    },
    ZWQZ (row) {
      this.ZWQZModal = true
      this.id = row.id
    },
    ZWQZOk () {
      this.modalInfo = {
        id: this.id,
        supervise_start: '12'
      }
      console.log(this.modalInfo)
      relieveIsolation(this.modalInfo).then(res => {
        if (res.data.errcode === 0) {
          this.$Notice.success({
            title: '',
            desc: '转为送诊成功'
          })
          this.ZWQZModal = false
          this.modalInfo = {}
          this.selectlist()
        } else {
          this.$Notice.error({
            title: '失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    confirmJc () { // 承诺解除管控
      console.log(this.jcglInfo.supervise_end_time, 'jcglInfo.supervise_end_time')
      if (date2str(this.jcglInfo.supervise_end_time) === '' || date2str(this.jcglInfo.supervise_end_time) === undefined) {
        this.$Notice.error({
          title: '失败',
          desc: '请选择管控结束时间'
        })
        return
      }
      let params = {
        id: this.id,
        supervise_start: '6',
        supervise_end_time: date2str(this.jcglInfo.supervise_end_time)
      }
      console.log(params)
      // if (date2str(this.jcglInfo.supervise_end_time) === this.temp_supervise_end_time) {
      //   this.$Notice.error({
      //     title: '失败',
      //     desc: '请选择本次管控结束时间'
      //   })
      //   return
      // }
      updateRelieveIsolationsq(params).then(res => {
        if (res.data.errcode === 0) {
          this.$Notice.success({
            title: '',
            desc: '解除管控成功'
          })
          this.jcglInfo.show = false
          this.selectlist()
          return
        }
        this.$Notice.error({
          title: '失败',
          desc: res.data.errmsg
        })
        this.jcglInfo.show = false
      })
    },
    cancelJc () { // 解除管控
      this.jcglInfo.show = false
    },
    pageAction (page) {
      this.params.pageNo = page
      this.getList()
    },
    changeuserControlType1 () {
      let param = {
        pageNo: 1,
        pageSize: 60,
        type: 'xgc_usercontroltype' + this.params.user_control_type1
      }
      getDictList(param).then(res => {
        if (res.data.errcode === 0) {
          this.userControlType2 = res.data.data.results
          if (this.userControlType2.length > 0) {
            let dic = { 'label': '全部', 'value': '' }
            this.userControlType2.unshift(dic)
          }
        } else {
          this.$Notice.error({ title: '查询失败' })
        }
      })
    },
    geteuserControlType () {
      let param = {
        pageNo: 1,
        pageSize: 60,
        type: 'xgc_usercontroltype' + this.params.user_control_type1
      }
      getDictList(param).then(res => {
        if (res.data.errcode === 0) {
          this.userControlType2 = res.data.data.results
          if (this.userControlType2.length > 0) {
            let dic = { 'label': '全部', 'value': '' }
            this.userControlType2.unshift(dic)
          }
        } else {
          this.$Notice.error({ title: '查询失败' })
        }
      })
    },
    selectlist (inpageNo) {
      if (inpageNo) {
        this.params.pageNo = inpageNo
      } else if (saveparams.info.list && saveparams.info.list.pageNo) {
        this.params.pageNo = saveparams.info.list.pageNo
      } else {
        this.params.pageNo = 1
      }
      if (this.type) {
        this.params.type = this.type
      }
      if (this.params.area1 === '全部') {
        this.params.area = ''
      } else {
        this.params.area = this.params.area1
      }
      if (this.params.area2 === '全部') {
        this.params.street = ''
      } else {
        this.params.street = this.params.area2
      }
      if (this.params.area3 === '全部') {
        this.params.community = ''
      } else {
        this.params.community = this.params.area3
      }
      if (this.params.province2 === '全部') {
        this.params.originate_province = ''
      } else {
        this.params.originate_province = this.params.province2
      }
      if (this.params.city2 === '全部') {
        this.params.originate_city = ''
      } else {
        this.params.originate_city = this.params.city2
      }
      if (this.params.user_control_type1 !== '2') {
        this.params.follow_person = ''
      }
      if (this.params.follow_person === '全部') {
        this.params.follow_person = ''
      } else {
        this.params.follow_person = this.params.follow_person
      }
      if (this.params.user_control_type1 === '全部') {
        this.params.user_control_type1 = ''
      } else {
        this.params.user_control_type1 = this.params.user_control_type1
      }
      if (this.params.user_control_type2 === '全部') {
        this.params.user_control_type2 = ''
      } else {
        this.params.user_control_type2 = this.params.user_control_type2
      }
      if (this.params.follow_level === '全部') {
        this.params.follow_level = ''
      } else {
        this.params.follow_level = this.params.follow_level
      }
      if (this.params.is_transfer === '全部') {
        this.params.is_transfer = ''
      } else {
        this.params.is_transfer = this.params.is_transfer
      }
      this.getList()
    },
    getList () {
      // ---调用接口可以打开
      if (this.$route.query.type === '1') {
        this.params.hot = '1'
      } else if (this.$route.query.type === '2') {
        this.params.hot = ''
      } else {
        this.params.hot = ''
      }
      this.fcDataList = []
      this.loadData = true
      userlist(this.params).then(res => {
        let result = res.data
        let that = this
        if (res.data.errcode === 0 || res.data.errcode === 1001) {
          this.fcDataList = res.data.data.results
          this.fcDataList.forEach(function (temp1, index) {
            for (var i = 0; i < that.dictList.length; i++) {
              if (temp1.arrive_address_type === that.dictList[i].value) {
                temp1.arrive_address_type1 = that.dictList[i].label
              }
            }
            for (var j = 0; j < that.superviseDictList.length; j++) {
              if (temp1.supervise_start === that.superviseDictList[j].value) {
                temp1.supervise_start1 = that.superviseDictList[j].label
              }
            }
            let tempCardno = temp1.card_no
            if (tempCardno) {
              temp1.card_no1 = `${tempCardno.substring(0, 10)}******${tempCardno.substring(tempCardno.length - 2)}`
            }
            // let tempMobile = temp1.tel
            // if (tempMobile) {
            //  if (tempMobile.length === 11) {
            //    temp1.tel1 = `${tempMobile.substring(0, 3)}****${tempMobile.substring(tempMobile.length - 4)}`
            //  } else {
            //    temp1.tel1 = `${tempMobile.substring(0, 3)}****`
            //  }
            // }
            let tempAddress = temp1.address
            if (tempAddress) {
              temp1.address1 = that.hideCode(tempAddress, 4, 2)
            }
            let tempBirthday = temp1.birthday
            if (tempBirthday) {
              this.datalist[i].birthday = `${tempBirthday.substring(0, 4)}****`
            }
          })
          this.loadData = false
          this.countData.fcnum = res.data.data.totalRecord
          this.params = {
            pageNo: result.data.pageNo,
            pageSize: result.data.pageSize,
            totalPage: result.data.totalPage,
            totalRecord: result.data.totalRecord,
            area: this.params.area,
            street: this.params.street,
            community: this.params.community,
            area1: this.params.area1,
            area2: this.params.area2,
            area3: this.params.area3,
            card_no: this.params.card_no,
            name: this.params.name,
            tel: this.params.tel,
            arrive_address_type: this.params.arrive_address_type,
            hot: this.params.hot,
            isfollow: this.params.isfollow,
            illness_state: this.params.illness_state,
            isout_sheny: this.params.isout_sheny,
            user_type: this.params.user_type,
            state: this.params.state,
            originate_province: this.params.originate_province,
            originate_city: this.params.originate_city,
            province2: this.params.province2,
            city2: this.params.city2,
            // inout_state: this.params.inout_state,
            supervise_start: this.params.supervise_start,
            supervise_timeout: this.params.supervise_timeout,
            states: this.params.states,
            nucleic_acid: this.params.nucleic_acid,
            isolation: this.params.isolation,
            follow_person: this.params.follow_person,
            user_control_type1: this.params.user_control_type1,
            user_control_type2: this.params.user_control_type2,
            follow_level: this.params.follow_level,
            is_transfer: this.params.is_transfer,
            detection_1_result: this.params.detection_1_result,
            detection_2_result: this.params.detection_2_result,
            risk_groups: this.params.risk_groups
          }
          saveparams.info.list = this.params
        } else {
          this.loadData = true
          this.$Notice.error({
            title: '查询列表信息失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    chaneProv (index) {
      let temparea = this.params['province' + index]
      if (!temparea) {
        return
      }
      let templist = this.inoutCity.provinceList
      let tempdata = {}
      for (let i = 0; i < templist.length; i++) {
        if (temparea === templist[i].name) {
          tempdata = templist[i]
          break
        }
      }
      this.getCity(tempdata.code, 'city' + index, false)
    },
    getCity (code, listname, flag) {
      getCityList({ code: code }).then(res => {
        if (res.data.errcode === 0) {
          this.inoutCity[listname] = res.data.data
          let obj = {
            code: '-',
            name: '全部'
          }
          this.inoutCity[listname].splice(0, 0, obj)
          if (flag) {
            if (this.formInfo.province1) {
              this.chaneProv(1)
            }
            if (this.formInfo.province2) {
              this.chaneProv(2)
            }
          }
        } else {
          this.$Notice.error({ title: '查询失败' })
        }
      })
    },
    getAllList () {
      findOutAllList({}).then(res => {
        if (res.data.errcode === 0 || res.data.errcode === 1001) {
          this.fcAllDataList = JSON.parse(res.data.data.list)
          this.loading = false
          this.$refs.table.exportCsv({
            filename: '疫情监控人员信息',
            columns: this.columns1,
            // columns: this.columns1.filter((col, index) => index < 20),
            data: this.fcAllDataList.map(item => {
              item.来沈时间 = '="' + item.来沈时间 + '"'
              item.填写时间 = '="' + item.填写时间 + '"'
              // if (item.hot === '1') {
              //  item.hot = '发热'
              // } else if (item.hot === '0') {
              //  item.hot = '未发热'
              // }
              // if (item.referral === '0') {
              //  item.referral = '未送诊'
              // } else if (item.referral === '1') {
              //  item.referral = '已送诊'
              // }
              // if (item.isfollow === '1') {
              //  item.isfollow = '是'
              // } else if (item.isfollow === '0') {
              //  item.isfollow = '否'
              // }
              // if (item.arrive_address_type === '1') {
              //  item.arrive_address_type = '湖北武汉'
              // } else if (item.arrive_address_type === '2') {
              //  item.arrive_address_type = '湖北其他城市'
              // } else if (item.arrive_address_type === '4') {
              //  item.arrive_address_type = '武汉海鲜市场'
              // } else if (item.arrive_address_type === '3') {
              //  item.arrive_address_type = '其他省市'
              // }
              return item
            }),
            original: false
          })
          console.log('123123')
        } else {
          this.$Notice.error({
            title: '查询全部人员信息列表失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    findDictList (value) {
      // let that = this
      var dic = { 'label': '全部', 'value': '' }
      getDictList({ type: 'arrive_address_type', pageSize: 60, pageNo: 1 }).then(res => {
        if (res.data.errcode === 0) {
          this.dictList = res.data.data.results
          this.dictList.unshift(dic)
          // setTimeout(function () {
          //   that.selectlist()
          // }, 500)
        } else {
          this.$Notice.error({ title: '查询失败' })
        }
      })
      getDictList({ type: 'follow_person', pageSize: 60, pageNo: 1 }).then(res => {
        if (res.data.errcode === 0) {
          this.follow_personList = res.data.data.results
          this.follow_personList.unshift(dic)
          // setTimeout(function () {
          //   that.selectlist()
          // }, 500)
        } else {
          this.$Notice.error({ title: '查询失败' })
        }
      })
      getDictList({ type: 'xgc_usercontroltype', pageSize: 60, pageNo: 1 }).then(res => {
        if (res.data.errcode === 0) {
          this.userControlType1 = res.data.data.results
          this.userControlType1.forEach((item, index) => {
            getDictList({ type: 'xgc_usercontroltype' + item.value, pageSize: 60, pageNo: 1 }).then(res1 => {
              if (res.data.errcode === 0) {
                item.downlist = res1.data.data.results
              } else {
                this.$Notice.error({ title: '查询失败' })
              }
            })
          })
          this.userControlType1.unshift(dic)
          // setTimeout(function () {
          //   that.selectlist()
          // }, 500)
        } else {
          this.$Notice.error({ title: '查询失败' })
        }
      })
      getDictList({ type: 'is_transfer', pageSize: 30, pageNo: 1 }).then(res => {
        if (res.data.errcode === 0) {
          this.is_transferList = res.data.data.results
          this.is_transferList.unshift(dic)
          // setTimeout(function () {
          //   that.selectlist()
          // }, 500)
        } else {
          this.$Notice.error({ title: '查询失败' })
        }
      })
      getDictList({ type: 'supervise_start', pageSize: 30, pageNo: 1 }).then(res => {
        if (res.data.errcode === 0) {
          // this.superviseDictList = res.data.data.results
          this.superviseDictList = JSON.parse(JSON.stringify(res.data.data.results))
          let List = res.data.data.results
          List.forEach((item, index) => {
            // console.log(item.value, item.label)
            if (item.value === '7') {
              console.log(index)
              List.splice(index, 1)
            }
          })
          console.log(List)
          List.forEach((item, index) => {
            // console.log(item.value, item.label)
            if (item.value === '5') {
              console.log(index)
              List.splice(index, 1)
            }
          })
          List.forEach((item, index) => {
            // console.log(item.value, item.label)
            if (item.value === '4') {
              console.log(index)
              List.splice(index, 1)
            }
          })
          this.superviseOneDictList = List
          this.superviseOneDictList.unshift(dic)
          var dics4 = { 'label': '集中转居家', 'value': '4' }
          this.superviseOneDictList.push(dics4)
          // setTimeout(function () {
          //   that.selectlist()
          // }, 500)
        } else {
          this.$Notice.error({ title: '查询失败' })
        }
      })
    },
    getCityInfoList (code, index) {
      let param = {
        code: code,
        pageNo: 1,
        pageSize: 200
      }
      getCityList(param).then(res => {
        if (res.data.data) {
          this.cityInfo['list' + index] = res.data.data
          this.change(index)
        } else {
          this.$Notice.error({ title: '查看失败', desc: '查询省市地址信息失败' })
        }
      })
    },
    deleteRow (row) {
      this.$Modal.confirm({
        title: '确认删除该人员信息吗？',
        content: '删除后不可恢复，请确认后再操作！',
        onOk: () => {
          delbyid({ id: row.id }).then(res => {
            if (res.data.errcode === 0) {
              this.getList()
            } else {
              this.$Notice.error({
                title: '删除人员信息失败',
                desc: res.data.errmsg
              })
            }
          })
        }
      })
    },
    jzgl (row) {
      this.jzmodal1 = true
      this.id = row.id
    },
    zwjkgl (row) {
      if (!row.user_control_type2) {
        this.$Notice.error({
          title: '失败',
          desc: '人员基本信息人员类型二级为空，转换失败！'
        })
        return
      }
      console.log('点击了自我健康管理')
      this.zwlInfo.show = true
      this.zwlInfo.supervisezw_time = row.supervisezw_time
      this.zwlInfo.supervisezw_end_time = row.supervisezw_end_time
      this.zwlInfo.id = row.id
      this.zwlInfo.supervise_start = '14'
    },
    saveZwjkgl () {
      console.log('点击了自我健康管理确认:', this.zwlInfo)
      if (!this.zwlInfo.supervisezw_time) {
        this.$Notice.error({
          title: '请完善本次自我健康管理开始日期',
          desc: res.data.errmsg
        })
        return
      }
      if (!this.zwlInfo.supervisezw_end_time) {
        this.$Notice.error({
          title: '请完善本次自我健康管理结束日期',
          desc: res.data.errmsg
        })
        return
      }
      this.zwlInfo.supervisezw_time = date2str(this.zwlInfo.supervisezw_time)
      this.zwlInfo.supervisezw_end_time = date2str(this.zwlInfo.supervisezw_end_time)
      updateRelieveIsolationsq(this.zwlInfo).then(res => {
        if (res.data.errcode === 0) {
          this.$Notice.success({
            title: '',
            desc: '操作成功'
          })
          this.zwlInfo.show = false
          this.modalInfo = {}
          this.selectlist()
        } else {
          this.$Notice.error({
            title: '操作失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    saveJksf (row) {
      if (row.supervise_start === '15') {
        this.$Notice.error({
          title: '失败',
          desc: '当前人员已为健康随访状态，无需进行次操作！'
        })
        return
      }
      this.$Modal.confirm({
        title: '温馨提示',
        content: '是否确认将人员管控状态转为健康随访',
        okText: '确认',
        cancelText: '取消',
        onCancel: () => { },
        onOk: () => {
          let params = {
            id: row.id,
            supervise_start: '15'
          }
          console.log('点击了健康随访确认:', params)
          updateRelieveIsolationsq(params).then(res => {
            if (res.data.errcode === 0) {
              this.$Notice.success({
                title: '',
                desc: '操作成功'
              })
              this.zwlInfo.show = false
              this.modalInfo = {}
              this.selectlist()
            } else {
              this.$Notice.error({
                title: '操作失败',
                desc: res.data.errmsg
              })
            }
          })
        }
      })
    },
    moveOut (row) {
      this.modal3 = true
      this.id = row.id
      this.getCompanyList()
    },
    passCheck (row, type) {
      this.modalCard = true
      this.id = row.id
      if (type === 'paper') {
        this.titleCard = '纸质证明办理'
        this.checkCardTitle = '是 否 已 办 理 纸 质 证 明 ？'
      } else if (type === 'app') {
        this.titleCard = '电子证明办理'
        this.checkCardTitle = '是 否 已 办 理 电 子 证 明 ？'
      }
    },
    quarantine (row) { // 设置隔离状态
      this.modal5 = true
      this.quarantineParam.isolation = row.isolation
      this.id = row.id
      this.quarantineParam.id = this.id
    },
    saveQuarantine () {
      updateuserinfo(this.quarantineParam).then(res => {
        if (res.data.errcode === 0) {
          this.$Notice.success({
            title: '',
            desc: '隔离状态设置成功'
          })
          this.modal5 = false
          this.getList()
        } else {
          this.$Notice.error({
            title: '隔离状态设置失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    okCard () {
      let params = {}
      if (this.titleCard === '纸质证明办理') {
        params = {
          id: this.id,
          paper_card: '1'
        }
      } else if (this.titleCard === '电子证明办理') {
        params = {
          id: this.id,
          app_card: '1'
        }
      }
      updateuserinfo(params).then(res => {
        if (res.data.errcode === 0) {
          this.$Notice.success({
            title: '',
            desc: '证明办理成功'
          })
          this.modal4 = false
          this.getList()
        } else {
          this.$Notice.error({
            title: '证明办理失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    addPerson (what) {
      this.$router.push({ path: '/yi-qing/add-buttons' })
    },
    census () {
      this.$router.push({ path: '/yi-qing/statistics' })
    },
    showdetail (row, what, states) {
      this.$router.push({
        path: '/yi-qing/add',
        query: {
          id: row.id,
          what: what,
          arrive_address_type: row.arrive_address_type,
          user_type: this.params.user_type,
          state: states
        }
      })
    },
    exchange (row) {
      let user_type = ''
      if (this.$route.query.user_type === '1') {
        user_type = '2'
      } else if (this.$route.query.user_type === '2') {
        user_type = '1'
      }
      this.$router.push({ path: '/yi-qing/add', query: { id: row.id, what: 'edit', arrive_address_type: row.arrive_address_type, user_type: user_type, exchange_type: true } })
      // if (confirm('确定转换该人员信息？')) {
      //   updateuserinfo({ id: row.id, user_type: user_type, chang_type: '1' }).then(res => {
      //     if (res.data.errcode === 0) {
      //       this.$Notice.success({
      //         title: '',
      //         desc: '转换人员信息成功'
      //       })
      //       this.modal4 = false
      //       this.getList()
      //     } else {
      //       this.$Notice.error({
      //         title: '转换人员信息失败',
      //         desc: res.data.errmsg
      //       })
      //     }
      //   })
      // }
    },
    temperature (row) {
      this.$router.push({ path: '/yi-qing/fever-list', query: { id: row.id } })
    },
    fever (row) {
      this.modal1 = true
      this.hot = row.hot
      this.id = row.id
    },
    Referral (row) {
      this.findHospitalList()
      this.modal2 = true
      this.referralInfo.referral = row.referral
      this.referralInfo.referral_address = row.referral_address
      this.referralInfo.id = row.id
    },
    queren (row) {
      updateAffirmTime(row).then(res => {
        if (res.data.errcode === 0) {
          this.$Notice.success({
            title: '',
            desc: '确认成功'
          })
          this.getList()
        } else {
          this.$Notice.error({
            title: '确认失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    huitui (row) {
      let params = {
        id: row.id,
        supervise_start: '7'
      }
      relieveIsolation(params).then(res => {
        if (res.data.errcode === 0) {
          this.$Notice.success({
            title: '',
            desc: '退回成功'
          })
          this.getList()
        } else {
          this.$Notice.error({
            title: '退回失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    leave (row) {
      this.getCityInfoList('', 1)
      this.modal4 = true
      this.modalInfo1.id = row.id
      this.modalInfo1.inout_state = row.inout_state
      this.modalInfo1.isout_sheny_remark = row.isout_sheny_remark
      this.modalInfo1.out_time = row.out_time
      this.modalInfo1.out_type = row.out_type
      this.modalInfo1.out_type_remark = row.out_type_remark
      this.modalInfo1.province1 = row.out_province
      this.modalInfo1.province2 = row.out_city
    },
    ok1 () {
      updateuserinfo(this.referralInfo).then(res => {
        if (res.data.errcode === 0) {
          this.$Notice.success({
            title: '',
            desc: '更改送诊信息成功'
          })
          this.modal1 = false
          this.getList()
        } else {
          this.$Notice.error({
            title: '更改送诊状态失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    ok2 () {
      this.modalInfo1.out_province = this.modalInfo1.province1
      this.modalInfo1.out_city = this.modalInfo1.province2
      this.modalInfo1.out_time = date0str(this.modalInfo1.out_time)
      updateuserinfo(this.modalInfo1).then(res => {
        if (res.data.errcode === 0) {
          this.$Notice.success({
            title: '',
            desc: '更改离沈信息成功'
          })
          this.modal4 = false
          this.getList()
        } else {
          this.$Notice.error({
            title: '更改离沈状态失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    ok () {
      updateuserinfo({ id: this.id, hot: this.hot }).then(res => {
        if (res.data.errcode === 0) {
          this.$Notice.success({
            title: '',
            desc: '更改发热状态成功'
          })
          this.modal1 = false
          this.getList()
        } else {
          this.$Notice.error({
            title: '更改发热状态失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    saveCompany () {
      console.log(JSON.parse(this.modalStr))
      this.modalInfo = {
        user_id: this.id,
        in_company: JSON.parse(this.modalStr).code,
        out_company_name: this.$store.state.user.severUserInfo.company_name,
        in_company_name: JSON.parse(this.modalStr).sq_name
      }
      createOutApplu(this.modalInfo).then(res => {
        if (res.data.errcode === 0) {
          this.$Notice.success({
            title: '',
            desc: '迁出人员信息成功'
          })
          this.modal1 = false
          this.getList()
        } else {
          this.$Notice.error({
            title: '迁出人员信息失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    cancel () {
      this.modal1 = false
      this.modal2 = false
      this.modal3 = false
      this.modal4 = false
      this.modal5 = false
      this.modalCard = false
    },
    perChange (index) {
      let temparea = this.params['area' + index]
      if (!temparea) {
        return
      }
      let templist = this.addressInfo['list' + index]
      let tempdata = {}
      for (let i = 0; i < templist.length; i++) {
        if (temparea === templist[i].title) {
          tempdata = templist[i]
        }
      }
      this.getDownAddress(tempdata.id, index + 1)
    },
    change (index) {
      console.log(index, '1111')
      let temparea = this.modalInfo1['province' + index]
      console.log(temparea, '12121')
      if (!temparea) {
        return
      }
      let templist = this.cityInfo['list' + index]
      console.log(templist, '123313123213')
      let tempdata = {}
      for (let i = 0; i < templist.length; i++) {
        if (temparea === templist[i].name) {
          tempdata = templist[i]
        }
      }
      this.getCityInfoList(tempdata.code, index + 1)
    },
    // 下拉搜索框的级联查询
    getDownAddress (pid, index) {
      let param = {
        pid: pid,
        pageNo: 1,
        pageSize: 200
      }
      grid_downlist(param).then(res => {
        if (res.data.data) {
          this.addressInfo['list' + index] = res.data.data.results
          let obj = {
            id: '',
            level: '',
            mapjson: '',
            path: '',
            pid: 0,
            title: '全部'
          }
          this.addressInfo['list' + index].unshift(obj)
          this.perChange(index)
        } else {
          this.$Notice.error({ title: '查看失败', desc: '查询地址信息失败' })
        }
      })
    },
    getCompanyList () {
      getAllUserByMZNotNCList({}).then(res => {
        if (res.data.errcode === 0) {
          this.company_list = res.data.data
        } else {
          this.$Notice.error({
            title: '获取社区列表失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    findHospitalList () {
      findAllHospitalList({}).then(res => {
        if (res.data.errcode === 0) {
          this.hospital_list = res.data.data
        } else {
          this.$Notice.error({
            title: '获取定点医院列表失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    uploadImgAll (row, what) {
      this.row = row
      this.$refs.imgService.modelAction()
    },
    pageSizeChange (e) {
      this.params.pageSize = e
      this.selectlist(this.params.pageNo)
    },
    chuanSongAction () {
      this.$refs.turnPeopleModel.modelAction()
    },
    exportData (type) {
      if (this.fcAllDataList.length === 0) { // 没有数据需加载接口
        this.loading = true
        this.getAllList()
      } else {
        this.loading = false
        this.$refs.table.exportCsv({
          filename: '疫情监控人员信息',
          columns: this.columns1,
          // columns: this.columns1.filter((col, index) => index < 20),
          data: this.fcAllDataList.map(item => {
            // item.来沈时间 = '="' + item.来沈时间 + '"'
            // item.填写时间 = '="' + item.填写时间 + '"'
            // if (item.hot === '1') {
            //  item.hot = '发热'
            // } else if (item.hot === '0') {
            //  item.hot = '未发热'
            // }
            // if (item.referral === '0') {
            //  item.referral = '未送诊'
            // } else if (item.referral === '1') {
            //  item.referral = '已送诊'
            // }
            // if (item.isfollow === '1') {
            //  item.isfollow = '是'
            // } else if (item.isfollow === '0') {
            //  item.isfollow = '否'
            // }
            // if (item.arrive_address_type === '1') {
            //  item.arrive_address_type = '湖北武汉'
            // } else if (item.arrive_address_type === '2') {
            //  item.arrive_address_type = '湖北其他城市'
            // } else if (item.arrive_address_type === '4') {
            //  item.arrive_address_type = '武汉海鲜市场'
            // } else if (item.arrive_address_type === '3') {
            //  item.arrive_address_type = '其他省市'
            // }
            return item
          }),
          original: false
        })
      }
    },
    importExcel () {

    },
    hideCode (str, frontLen, endLen) {
      var len = str.length - frontLen - endLen
      var xing = ''
      for (var i = 0; i < len; i++) {
        xing += '*'
      }
      return str.substring(0, frontLen) + xing + str.substring(str.length - endLen)
    }
  },
  mounted () {
    let that = this
    if (saveparams.info.list !== undefined) {
      this.params = saveparams.info.list
      this.geteuserControlType()
      this.params.user_control_type2 = saveparams.info.list.user_control_type2
    }
    this.params.user_type = this.$route.query.user_type
    this.params.states = this.$route.query.states
    console.log(this.$route.query.user_type, 'dfsfafsd')
    this.findDictList()
    setTimeout(function () {
      that.selectlist()
    }, 500)
    // this.selectlist()
    this.getDownAddress(0, 1)
    this.getCity(null, 'provinceList', false)
    // this.getCompanyList()
  }
}
</script>

<style scoped>
    .page_style {
        margin: 20px 5px;
    }

    .input-frame {
        width: 120px;
        margin-right: 10px;
    }

    .house-list > .group {
        background: white;
        padding: 10px;
        margin-top: 10px;
    }

    .house-list > .group > .item {
        border-bottom: 1px solid #f5f5f5;
        padding: 10px 0;
    }

    .house-list > .group > .item .top {
        display: flex;
        justify-content: space-between;
        margin-bottom: 5px;
    }

    .house-list > .group > .item .title {
        font-size: 14px;
        color: #333333;
    }

    .house-list > .group > .item .address {
        font-size: 12px;
        color: gray;
        display: flex;
        align-items: center;
    }

    .house-list > .group > .item .detail {
        font-size: 12px;
        color: dodgerblue;
    }

    .opt-area-02 {
        display: flex;
        align-items: center;
        flex-direction: column;
        border: 1px solid #abdcff;
        background-color: #f0faff;
        padding: 8px 16px 8px 16px;
        border-radius: 4px;
        margin-bottom: 10px;
    }

    .opt-area-02 .right-con22 {
        width: 100%;
        margin-top: 5px;
        display: flex;
    }

    .opt-area-02 .left-con {
        font-size: 14px;
        width: 100%;
    }

    .opt-area-02 .left-con span {
        font-weight: bold;
    }

    .opt-area-02 .right-con22 input {
        margin-right: 10px;
    }

    .opt-area-02 .right-con22 .input-frame {
        width: 200px;
        margin-right: 10px;
    }

    .table-action-btn {
        margin-right: 3px;
    }

    .container >>> .ivu-btn-small {
        height: 24px;
        padding: 0 5px;
        font-size: 12px;
        border-radius: 3px;
    }

    .btn-action {
        margin-bottom: 10px;
    }

    .mp10 {
        margin-right: 10px;
    }
    .title-style {
      color: red;
    }
    .mb20 {
      margin-bottom: 20px;
    }
    .mt20 {
      margin-top: 20px;
    }
    .ivu-table-row {
      height: 57px;
    }
  .ivu-form-item-label {
    margin-top: 8px;
  }
    .demo-spin-icon-load{
      animation: ani-demo-spin 1s linear infinite;
    }
    @keyframes ani-demo-spin {
      from { transform: rotate(0deg);}
      50%  { transform: rotate(180deg);}
      to   { transform: rotate(360deg);}
    }
    .demo-spin-col{
      height: 100px;
      position: relative;
      /*border: 1px solid #eee;*/
    }
</style>
